#-*- codeing = utf-8 -*-
#@Time : 2020/9/8 12:38
#@Author : 阳某
#@File : 人民大学经济学院.py
#@Software : PyCharm


import requests
from openpyxl import Workbook
wb = Workbook()
wa = wb.active
url = 'http://mis.sem.tsinghua.edu.cn/psc/CRMPRD/EMPLOYEE/CRM/s/WEBLIB_TZ_ISRPT.TZ_WEB_JSWW2_FLD.FieldFormula.IScript_LoadTeaTeam?language=ZHS&_=1599540530064'

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
}
response = requests.get(url,headers = headers)

print(response.status_code)
print(response.json())
data = response.json()

# print(data[1:-1])
# data = data[1:-1]
# print(dict(data))
print(type(data))
print(len(data))
for da in data:
    line = []
    print(da)
    name = da['name']
    emai = da['email']
    if len(emai)!=0:
        line.append(name)
        line.append(emai)
        print(line)
        wa.append(line)
    else:
        print('没有邮箱')
        continue

wb.save('./经济管理学院')